package cn.diancan.service;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import cn.diancan.exception.OutMsgException;
import cn.diancan.model.SysAuthority;
import cn.diancan.vo.SysAuthorityVo;

 


public interface SysAuthorityService {
	/**
	 * 保存
	 * @return
	 * @throws OutMsgException 
	 */
	public boolean saveAuthority(SysAuthority bean) throws OutMsgException,Exception;
	
	/**
	 * 所有列表
	 * @return
	 */
	public List<SysAuthority> findAll();
	
	/**
	 * 顶级列表
	 * @return
	 */
	public List<SysAuthority> findTopList();
	
	/**
	 * 顶级列表2
	 * @return
	 */
	public List<SysAuthorityVo> findTopListBySql();
	
	/**
	 * 根据id集合查询
	 * @param ids
	 * @return
	 */
	public List<SysAuthority> findByIds(String ids) throws NumberFormatException, OutMsgException;
	
	/**
	 * 根据id查找
	 * @param id
	 * @return
	 */
	public SysAuthority findById(Long id) throws  OutMsgException;
	
	/**
	 * 查找所有权限的url
	 * @return
	 */
	public List<String> findAllUrl();
	
	/**
	 * 查找所有二级权限
	 * @throws OutMsgException 
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 */
	public List<SysAuthorityVo> findTopChild(Long prentId) throws OutMsgException, IllegalAccessException, InvocationTargetException;
	
	
	/**
	 * 删除权限
	 * @throws OutMsgException 
	 */
	public Boolean delete(Long id) throws OutMsgException,Exception;
	
	/**
	 * 根据权限名称查找
	 * @param name
	 * @return
	 * @throws OutMsgException
	 */
	SysAuthority findByName(String name) throws OutMsgException;

	/**
	 * 更改排序
	 * @param b true即上移
	 * @param pId 父级id
	 * @return
	 * @throws OutMsgException 
	 */
	public boolean updateIndex(boolean b, Long pId,Long id) throws OutMsgException,Exception;
}
